﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="Sbook.index" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="~/Control/Menu/MenuTop.ascx"  TagName="MenuTop" TagPrefix="UC" %>
<%@ Register Src="~/Control/Menu/Header.ascx"  TagName="Header" TagPrefix="UC" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sbook.vn</title>
<link type="text/css" rel="stylesheet" href="css/style_index.css" />
<link rel="stylesheet" href="css/nivo-style.css" type="text/css" />
<link rel="stylesheet" href="css/nivo-slider.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">
</script>
<script type="text/javascript" src="js/jquery.simplyscroll.js"></script>
<script  type="text/javascript" src="js/jquery.nivo.slider.pack.js"></script>

<link rel="stylesheet" href="css/jquery.simplyscroll.css" media="all" type="text/css" />

  <style>
                     div.login{position:absolute; display:none; z-index:1000; right:170px; top:35px; background-color:Aqua; width:250px; height:120px}
                     div.login ul.loginUl{ width:200px; height:200px; list-style:none; float:left}
                      div.login ul.loginUl li.loginLI{ float:left; width:100%; margin:5px 0px}
                      div.login ul.loginUl li.loginLI label{ float:left; width:50px}
                </style>
<script type="text/javascript">
    (function ($) {
        $(function () {
            $("#scroller").simplyScroll({
                customClass: 'vert',
                orientation: 'vertical',
                auto: false,
                manualMode: 'loop',
                speed: 8
            });
        });
    })(jQuery);
</script>

<script type="text/javascript">
        $(document).ready(function() {
            $('#slider').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices: 8,
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:true, //1,2,3...
        keyboardNav:true //Use left & right arrows
   
            });
        });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        $(".menu_top li").hover(function () {
            $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(500)
        }, function () {
            $(this).find('ul:first').css({ visibility: "hidden" })
        });
    });
</script>
</head>


<body>
<form runat="server" id="form1">
<center>
<div class="web">
    <UC:Header runat="server" ID="Header1"></UC:Header>
    <!-- close header -->
    <!-- slide -->
<div class="slide">
	<div id="wrapper">
         <div id="slider" class="nivoSlider">
            <a href="#"><img src="images/img5.png" alt="" title="Sbook.vn chìa khóa thành công"/></a>
            <asp:Repeater runat="server" ID="rptSlide">
                <ItemTemplate>
                    <img src='<%#Eval("Blink") %>' alt="" title=""/>
                </ItemTemplate>
            </asp:Repeater>
            
            <%--<img src="images/img2.png" alt="" title="Chia sẻ kiến thức" />
            <img src="images/img3.png" alt="" title="Nâng tầm trí tuệ" />
            <img src="images/img4.png" alt="" title="Chắp cánh tương lại"/>--%>
        </div>
        <div id="caption" class="nivo-html-caption">
            <strong>This</strong> is madness with <a href="http://www.izwebz.com">a link</a>
        </div>
    </div>
</div>

<div class="tintuc">
    
	<a href="#" class="up">
    	<img src="images/img_tintuc/news_box_up.jpg" alt="" />
    </a>
    <a href="#" class="down">
    	<img src="images/img_tintuc/news_box_down.jpg" alt="" />
    </a>
    <div id="scroller">
    <asp:Repeater ID="rpNews" runat="server">
    <ItemTemplate>
	<div class="tintuc_item">
    	<a href='/News/<%#Eval("NId") %>.aspx'  title='<%#Eval("NTitle") %>'>
        	<img src="<%#Eval("Image") %>" width="80" height="120" alt=""/>
        	<span>
            	<strong class="textheader" style="font-size:12px; height:40px; overflow:hidden;"><%#Eval("NTitle") %></strong>
                <br />
                <p style="width:180px; overflow:hidden; height:73px; font-size:11px; text-align:left; color:Black;"><%#Eval("NDescription")%></p>
            </span>
        </a>
        
    </div>
    </ItemTemplate>
    </asp:Repeater>
    </div>
</div>
<!-- close tin tức --> 
<!-- product --> 
<div class="product">
	<!-- sản phẩm mới --> 
	<div class="pro_new">
    	<!-- tiêu đề sản phẩm mới --> 
    	<h1>	
        	Sản phẩm mới
        </h1>
        <br />
    	<!-- sản phẩm mới item -->
        <asp:Repeater runat="server" ID="rpt_ProductsNew">
            <ItemTemplate>
                 <div class="pro_new_item" title='<%#Eval("PName") %>'>
        	            <a href="Product_Details.aspx?Product=<%#Eval("PId") %>"><img alt="" src="<%#Eval("PImg") %>" width="198" height="115" /></a>
                        <strong><%#Eval("PName") %></strong>
                 </div> 
            </ItemTemplate>
        </asp:Repeater>
       
      
        <!-- close sản phẩm mới item -->
	</div>
	<!-- close sản phẩm mới --> 
    <!-- sản phẩm bán chạy --> 
	<div class="pro_new">
    	<!-- tiêu đề sản phẩm bán chạy --> 
    	<h1>	
        	Sản phẩm bán chạy
        </h1>
        <br />
    	<!-- sản phẩm bán chạy item -->
        <asp:Repeater runat="server" ID="rptProducts_Banchay">
            <ItemTemplate>
                 <div class="pro_new_item" title='<%#Eval("PName") %>' style="overflow:hidden">
        	        <a href="Product_Details.aspx?Product=<%#Eval("PId") %>"><img alt="" src="<%#Eval("PImg") %>" width="198" height="115" /></a>
                    <strong><%#Eval("PName") %></strong>
                 </div> 
            </ItemTemplate>
        </asp:Repeater>
       
     
        <!-- close sản phẩm bán chạy item-->
	</div>
    <!-- close sản phẩm bán chạy --> 
</div>
<!-- close product --> 
<!-- banner quảng cáo --> 
<div class="banner">
	<div class="banner1">
    	<img src="<%=imgBanner1 %>" style="width:300px; height:200px" />
    </div>
    
    <div class="banner2">
    	<img src="<%= imgBanner2%>" style="width:300px; height:330px" />
    </div>
    
    <div class="banner3">
    	<img src="<%=imgBanner3 %>" style="width:300px; height:350px" />
    </div>
</div>
<!-- close banner quảng cáo --> 
<!-- footer --> 
<div class="footer">
</div>
<!-- close footer --> 
</div>
<style>
    #divChangePass{ width:500px; height:235px; position:absolute; display:none; background-color:White; border:1px solid #CCFFFF; left:385px; top:160px; z-index:1000}
    #divChangePass ul { float:left; width:100%; list-style:none;}
    #divChangePass ul li{ float:left; width:100%; margin-top:10px;}
    #divChangePass ul li span{ color:Red; display:none}
    #divChangePass ul li label{ float:left; width:200px; text-align:right; padding-right:5px;}
    #divChangePass ul li input[type=password]{ float:left;}
    #divChangePass h1{ color:Red; font-size:25px}
    #divChangePass a{ float:right; margin:0px 0px; padding:0px 0px }
</style>
<div id="divChangePass">
    <a href="#" id="closeChangePass">X</a>
    <form id="frm2">
        <h1>Đổi mật khẩu</h1>
        <ul>
            <li><label>Mật khẩu cũ:</label> <input type="password" id="txtOldPass" /><span id="spOldPass">Không được để trống.</span></li>
            <li><label>Mật khẩu mới:</label> <input type="password" id="txtNewPass" /><span id="spNewPass">Không được để trống.</span></li>
            <li><label>Xác nhận mật khẩu mới:</label> <input type="password" id="txtRePass" /><span id="spRePass">Không được để trống.</span></li>
            <li><input type="button" value="Đổi mật khẩu" id="btnChangePass" /></li>
        </ul>
    </form>

     
</div>
 <script type="text/javascript">
     $(document).ready(function () {
         var isLogin = $('#login').html();
         if (isLogin == "Đăng nhập") {
             $('#logout').hide();
             $('#Close').click(function () {
                 $('#divlogin').toggle(1000);
             });
             $('#login').click(function () {
                 $('#divlogin').toggle(1000);
                 $('#divDoiMK').css("display", "none");
             });
         }
         else {
             $('#logout').show();
             //                        $('#login').attr("href", "http://hn.24h.com.vn");
             $('#login').click(function () {

                 $('#divDoiMK').toggle(1000);
             });
             $('#CloseDMK').click(function () {
                 $('#divDoiMK').toggle(1000);
             });
         }


         $('#dangnhap').click(function () {

             var user = $('#user').val();
             var pass = $('#pass').val();

             window.location.href = "Demo.aspx?user=" + user + "&pass=" + pass;

         });
         //             Click đổi mật khẩu

         $('a#aDoiMK').click(function () {

             $('div.web').css("opacity", "0.25");
             $('div#divChangePass').css("display", "block");

             $('#divDoiMK').toggle(1000);

         });
         $('a#closeChangePass').click(function () {
             $('div.web').css("opacity", "1");
             $('div#divChangePass').css("display", "none");

             //                  $('#divDoiMK').toggle(1000);
         });

         $('div#divChangePass input[type=button]#btnChangePass').click(function () {

             var OldPass = $('#txtOldPass').val();
             var NewPass = $('#txtNewPass').val();
             var RePass = $('#txtRePass').val();
             var chkRePass = true;
             if (OldPass == "") {
                 $('span#spOldPass').css("display", "block");
             }
             if (NewPass == "") {
                 $('span#spNewPass').css("display", "block");
             }
             if (RePass == "") {
                 $('span#spRePass').css("display", "block");
             }


             var chkOldPass;
             if (OldPass != "" && NewPass != "" && RePass != "") {
                 $('div#divChangePass span').css("display", "none");

                 if (RePass != NewPass) {
                     $('span#spRePass').html("Xác nhận lại mật khẩu mới");
                     $('span#spRePass').css("display", "block");
                     chkRePass = false;
                 }
                 //check Exist OldPass
                 if (chkRePass == true) {
                     $.ajax({
                         type: "POST",
                         url: "/Page/DoiMatKhau.aspx",
                         data: { OldPass: OldPass, NewPass: NewPass },
                         success: function (data) {
                             if (data == "0") {
                                 alert("Mật khẩu không đúng");
                                 chkOldPass = false;

                             }
                             else {

                                 chkOldPass = true;
                                 alert("Đổi mât khẩu thành công");
                                 window.location.href = "index.aspx";
                             }

                         }
                     });

                 }
                 else {
                     return;
                 }

             }
         });

     });
            </script>
</center>
</form>
</body>

</html>

